/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package eu.easyedu.dictionary.api.nservice.impl;

import eu.easyedu.dictionary.api.model.Dictionary;
import eu.easyedu.dictionary.api.model.Language;
import eu.easyedu.dictionary.api.nservice.spi.DictionaryService;
import eu.easyedu.dictionary.api.util.ConnectionDoesNotExistsException;
import eu.easyedu.dictionary.api.util.ConnectionEventListener;
import eu.easyedu.dictionary.api.util.DatabaseUtils;
import eu.easyedu.dictionary.api.util.DbUtils;
import eu.easyedu.dictionary.api.util.Executable;
import eu.easyedu.persistence.Mapper;
import eu.easyedu.persistence.PersistenceProvider;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import org.openide.util.Exceptions;

/**
 *
 * @author hlavki
 */
public class DictionaryServiceImpl implements DictionaryService {

    private static final Logger log = Logger.getLogger(DictionaryServiceImpl.class.getName());
    private static final String CREATE_DDL_SCRIPT = "/eu/easyedu/dictionary/api/resources/dictionary-ddl.sql";

    public void createDictionaryDDL(Dictionary dict) {
        PersistenceUtil.executeInPersitenceContext(dict, new Executable<Void>() {

            public Void execute(Connection conn, PersistenceProvider pu) throws SQLException {
                DbUtils.executeSQL(CREATE_DDL_SCRIPT, conn);
                return null;
            }
        });
    }
}
